﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls">

    <!-- BEGIN ListView -->
    <Style x:Key="VerticalListView" TargetType="{x:Type Controls:SinacorListView}">
        <Style.Resources>

            <Style TargetType="{x:Type Controls:SinacorTextBlock}" />
            <Style TargetType="{x:Type Controls:SinacorLabel}" />

        </Style.Resources>

        <Setter Property="Border.BorderThickness" Value="1" />
        <Setter Property="Border.BorderBrush" Value="{DynamicResource BrushTreeViewBorder}" />
        <Setter Property="Panel.Background" Value="{DynamicResource BrushTreeViewBackground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:SinacorListView}">
                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="1,1,1,1" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" Name="Bd" SnapsToDevicePixels="True">
                        <Controls:SinacorScrollViewer Width="Auto" Height="Auto" Padding="{TemplateBinding Control.Padding}" Focusable="False">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                        </Controls:SinacorScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="Panel.Background" TargetName="Bd">
                                <Setter.Value>
                                    <DynamicResource ResourceKey="{x:Static SystemColors.ControlBrushKey}" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="ItemsControl.IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls:SinacorListView}" BasedOn="{StaticResource VerticalListView}" />
    <!-- END ListView -->


    <!-- BEGIN ListViewItem -->
    <Style TargetType="{x:Type Controls:SinacorListViewItem}">
        <Setter Property="Padding" Value="5,0" />
        <Setter Property="Margin" Value="4,4,0,0" />
        <Setter Property="MinHeight" Value="21" />

        <!--<Setter Property="IconStringFormat" Value="{Binding ToggleButtonStringFormat, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorListView}}}" />
        <Setter Property="IconTemplate" Value="{Binding IconTemplate, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorListView}}}" />
        <Setter Property="IconTemplateSelector" Value="{Binding IconTemplateSelector, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorListView}}}" />-->

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:SinacorListViewItem}">
                    <Border HorizontalAlignment="Left" BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="{TemplateBinding Control.Padding}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" Name="Bd" SnapsToDevicePixels="True">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                    </Border>
                   
                    <ControlTemplate.Triggers>
                        <!--
                        <Trigger Property="Selector.IsSelected" Value="True">
                            <Setter Property="Panel.Background" TargetName="Bd">
                                <Setter.Value>
                                    <DynamicResource ResourceKey="{x:Static SystemColors.HighlightBrushKey}" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="TextElement.Foreground">
                                <Setter.Value>
                                    <DynamicResource ResourceKey="{x:Static SystemColors.HighlightTextBrushKey}" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelected" Value="True" />
                                <Condition Property="Selector.IsSelectionActive" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.Background" TargetName="Bd">
                                <Setter.Value>
                                    <DynamicResource ResourceKey="{x:Static SystemColors.ControlBrushKey}" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="TextElement.Foreground">
                                <Setter.Value>
                                    <DynamicResource ResourceKey="{x:Static SystemColors.ControlTextBrushKey}" />
                                </Setter.Value>
                            </Setter>
                        </MultiTrigger>-->

                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="CornerRadius" TargetName="Bd" Value="3"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTreeViewItemBackgroundSelected}" TargetName="Bd"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="IsEnabled" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="{DynamicResource BrushTreeViewItemBackgroundSelectedUnfocused}" TargetName="Bd"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelected" Value="True"/>
                                <Condition Property="Selector.IsSelectionActive" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="{DynamicResource BrushTreeViewItemBackgroundSelectedUnfocused}" TargetName="Bd"/>
                        </MultiTrigger>

                        <Trigger Property="UIElement.IsEnabled" Value="False">
                            <Setter Property="TextElement.Foreground">
                                <Setter.Value>
                                    <DynamicResource ResourceKey="{x:Static SystemColors.GrayTextBrushKey}" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>

                        <Trigger Property="Controls:SinacorDragDrop.IsDragOver" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushTreeViewItemBackgroundSelectedUnfocused}" TargetName="Bd"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!-- END ListViewItem -->


    <!-- BEGIN HorizontalListView -->
    <Style x:Key="HorizontalListView" TargetType="{x:Type Controls:SinacorListView}" BasedOn="{StaticResource {x:Type Controls:SinacorListView}}">
        <Style.Setters>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style.Setters>
    </Style>
    <!-- END HorizontalListView -->

</ResourceDictionary>